#include "animal.h"

static animal_klass_info local_animal_klass = {animal_init};
animal_klass_info* animal_klass = &local_animal_klass;

static animal* animal_ctor(animal* self)
{
	memset(self->name, 0x00, sizeof(self->name));
	self->weight = 0;
	return self;
}

static animal* animal_dtor(animal* self)
{
	return self;
}

void animal_init(void)
{
	if(animal_klass->init)
	{
		animal_klass->init = NULL;
		animal_klass->super = NULL;
		animal_klass->name = "animal_klass";
		animal_klass->size = sizeof(animal);
		animal_klass->ctor = animal_ctor;
		animal_klass->dtor = animal_dtor;
	}
}

char* animal_get_name(animal* self)
{
	return self->name;
}

void animal_set_name(animal* self, char* name)
{
	strncpy(self->name, name, sizeof(self->name));
}

int animal_get_weight(animal* self)
{
	return self->weight;
}

void animal_set_weight(animal* self, int weight)
{
	self->weight = weight;
}
